<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<!-- <script src='/Public/jquery.min.js'></script> -->
  <script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
  
	<script src='/Public/foundation/js/foundation.min.js'></script>
	<link rel="stylesheet" href="/Public/foundation/css/foundation.min.css">
  <script src='/Public/jquery.cityselect.js'></script>
  <script src='/Public/jquery.datetimepicker.full.js'></script>
  <link rel="stylesheet" href="/Public/jquery.datetimepicker.css">
   <script src="http://cdn.static.runoob.com/libs/foundation/5.5.3/js/vendor/modernizr.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav class="top-bar" data-topbar>
  <ul class="title-area">
    <li class="name">
      <h1><a href="#">后台管理</a></h1>
    </li>
  </ul>

  <section class="top-bar-section">
    <ul class="right">
      <li><a href=""><?php echo (session('name')); ?></a></li>
      <li><a href="<?php echo U('Login/doLogout');?>">退出</a></li>
    </ul>
  </section>
</nav>

<div class="small-2 columns">
<ul class="side-nav">
 <?php if(is_array($nav)): $i = 0; $__LIST__ = $nav;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li><a href="<?php echo U($vo['url']);?>" target='<?php echo ($vo["target"]?"_blank":null); ?>'><?php echo ($vo["mname"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
    </ul>
</div>
<div class="small-10 columns">

<link rel="stylesheet" href="http://static.runoob.com/assets/foundation-icons/foundation-icons.css">
<style>
	.u_roleDiv{
		width:150px;
		display: inline-block;
		float:left;
		text-align:center;
		margin:5px;
	}
	.u_roleDiv a{
		padding:5px;
		min-width:140px;
		display: block;
		background-color: black;
		color: white;
	}
	.u_roleDiv a .u_icon{
		color:white;
	}
	.u_roleDiv a:hover{
		padding:5px;
		background-color: #2B2B2B;
		color: white;
	}
	.u_roleDiv a:hover .u_icon{
		color: white;
	}
</style>
	<h4>移除权限</h4>
	<div id="possess" class="row">
		<?php if(is_array($roleName)): $i = 0; $__LIST__ = $roleName;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class='u_roleDiv'>
				<a onclick='sendDel(this)' value='<?php echo ($key); ?>'><?php echo ($vo); ?> <i class="fi-minus u_icon"></i></a>
			</div><?php endforeach; endif; else: echo "" ;endif; ?>
	</div>
	<h4>添加权限</h4>
	<div id="lose" class="row">
		<?php if(is_array($notHave)): $i = 0; $__LIST__ = $notHave;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class='u_roleDiv'>
				<a onclick='sendAdd(this)' value='<?php echo ($key); ?>'><?php echo ($vo); ?> <i class="fi-plus u_icon"></i></a>
			</div><?php endforeach; endif; else: echo "" ;endif; ?>
	</div>
<script>
	var sendDel = function(e){
		var id,text;
		id = $(e).attr('value');
		$(e).find('i').attr('class','fi-plus u_icon');
		$(e).attr('onclick','sendAdd(this)');
		$('#lose').append($(e).parent().clone());
		// $(e).parent().clone().prependTo($('#lose'));
		$(e).parent().remove();
		$.get('<?php echo U("doEditRoles");?>',{id:id,role_id:<?php echo ($_GET["role_id"]); ?>},function(){

		});
	}

	var sendAdd = function(e){
		var id;
		id = $(e).attr('value');
		$(e).find('i').attr('class','fi-minus u_icon');
		$(e).attr('onclick','sendDel(this)');
		$('#possess').append($(e).parent().clone());
		// $(e).parent().clone().prependTo($('#possess'));
		$(e).parent().remove();
		$.get('<?php echo U("doEditRoles");?>',{id:id,role_id:<?php echo ($_GET["role_id"]); ?>},function(){

		});
	}


</script>

</div>

</body>
</html>